package com.lxw.report.meta.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lxw.report.meta.contract.BaseResponse;
import com.lxw.report.meta.contract.SysUser.SysUserFindRequest;
import com.lxw.report.meta.contract.SysUser.SysUserRoleCreateBatchRequest;
import com.lxw.report.meta.entity.User;
import com.lxw.report.meta.service.ComplexService;
import com.lxw.report.meta.service.IUserService;
import com.lxw.report.meta.vo.ResultVo;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author xuxueli 2017-08-01 21:39:47
 */
@Api(tags = "用户管理")
@RestController
@RequestMapping ( "/user" )
public class UserController{

    @Autowired
    private ComplexService complexService;
    @Autowired
    private IUserService userService;

    @RequestMapping("/info")
    @ResponseBody
    public ResultVo<User> userInfo() {

        return ResultVo.success();
    }

    @RequestMapping("/find")
    @ResponseBody
    public ResultVo<List<User>> userInfoList(SysUserFindRequest findRequest) {

        return ResultVo.success();
    }

    @PostMapping("/addUserRoleBatch")
    @ResponseBody
    public ResultVo addUserRoleBatch(HttpServletRequest request, @Validated SysUserRoleCreateBatchRequest createRequest, BindingResult bindingResult) {
        BaseResponse baseResponse = complexService.addUserRoleBatch(createRequest);
        return ResultVo.success();
    }

}